
summaryListForTeacher = function(id){
	
    Ext.define('summaryModel',{
        extend: 'Ext.data.Model',
        fields: [
            {name: 'summaryId',type: 'String'},
             {name: 'studentId',type: 'String'},
             {name: 'title',type: 'String'},
             {name: 'contentText', type: 'String'},
             {name: 'createDate', type: 'String'},
             {name: 'state',type: 'String'},
             {name:'remark',type:'String'},
             {name:'visible',type:'String'},
             {name:'academicYear',type:'String'},
             {name:'modifyDateLimit',type:'String'}
         ]
    });
	
    var isVisibleStore = getStaticDataStore('isVisible');
    
	var summaryStore = Ext.create('Ext.data.Store',{
		pageSize:8,
		model: summaryModel,
	    autoLoad:true,
	    proxy:{
	        type: 'ajax',
	        url: 'searchSummaryListAction.action?',
	        reader:{
	           type: 'json',
	           root: 'resultList.list',            
	           totalProperty: 'resultList.total'
	        },
	        extraParams:{
	            	studentId:id,
	            	visible:2
	        }
	   }
	       
	   });
	var grid = Ext.create('Ext.grid.GridPanel',{
		store:summaryStore,
		columnLines:true,
		//selModel:checkBox,
		disableSelection:false,
		loadMask:true,
	
		columns:[
		         {xtype: 'rownumberer',text:'序号',width:40},
		         {text:'编号',width:'10%',dataIndex:'summaryId',sortable:true},
		         {text:'标题',width:'20%',dataIndex:'title',sortable:true},
		         {text:'内容',width:'45%',dataIndex:'contentText',hidden:true},
		         {text:"创建时间",width:'15%',dataIndex:'createDate',renderer : function(_registerDate){
		             return _registerDate.replace("T"," ").substring(0,16);
		         }},
		         {text:'备注',width:'10%',dataIndex:'remark'},
		         {text:'是否公开',width:60,dataIndex:'visible',renderer:function(v){
        			 var index = isVisibleStore.find('valueId',v); 
        			 if(index != -1){
        				 var r = isVisibleStore.getAt(index);
        				 return r.get("valueName");
        			 }
        			 else{
        				 return v;
        			 }
        	 } }
		         ],
		
		width:'100%',
		title:"自我总结列表",
		loadMask:true,
		pageSize: 5,
		dockedItems:[{
			dock:'top',
			xtype:'toolbar',//"<span style='color:red'>双击可以修改</span>",'-',	
			items:[{
				width:300,
				fieldLabel:'搜索',
				labelWidth:70,
				xtype:'searchfield',
				store:summaryStore			
			},{
				xtype:'label',
				html:'<div style="font-size:12px;color:red">标题模糊查询</div>'
			},'-',{
				text:'刷新',
				iconCls:'ArrowRefresh',
				xtype:'button',
				handler:function(){
					grid.store.reload();
				}
			}]		
		},{
			dock:'bottom',
			xtype:'pagingtoolbar',	
			store:summaryStore,
			displayInfo:true,
			displayMsg:'显示{0}-{1}条，共计{2}条',
			emptyMsg:"没有数据"
		},{
			dock:'bottom',
			xtype:'label',
			html:'<div style="font-size:12px;color:red">*双击可查看详细信息</div>'
		}],
		listeners:{  
			//双击事件
			itemdblclick : function( grid, record, item, index, e, eOpts){  
				var selectedKeys = grid.getSelectionModel().getSelection();
				showDetails(selectedKeys);
				
			       }  
		}
	});

	function showDetails(data){
		
		var tabId = "summaryDetails" + data[0].get("summaryId");
    	var tabName = data[0].get("title").length > 15?data[0].get("title").substring(0,20):data[0].get("title");
    	/*var url = 'jsp/student/showSummary.jsp?';
    	url+="&studentId="+data[0].get("studentId");
    	url+="&summaryId="+data[0].get("summaryId");
    	url +="&title="+data[0].get("title");
    	url +="&createDate="+data[0].get("createDate");
    	url +='&contentText='+data[0].get("contentText");
    	url +="&remark="+data[0].get("remark");
    //	url.replace('"', '/'');
    	url = url.replace(/\"/g,"'");*/
    	var createDate = data[0].get("createDate");
    	createDate = createDate.replace("T"," ").substring(0,16);
    //	alert(url);
		var tab = center.queryById(tabId);
	        if (!tab) {
	        	var tab = center.add({
	        		id: tabId,
	        		iconCls: 'Bookopen',       
	        		xtype: "panel",
	        		title: tabName,
	        		closable: true,
	        		//maskDiabled: true,
	        		frame: true,
	        		autoScroll : true,
	        		region:center,
	        		//baseCls:'allBackImage',
	        		bodyStyle: 'background:white;',
	        		//html:'<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="'+url+'"></iframe>'
	        		html:'<center><h2>'+data[0].get("title")+'</h2><span style="font-size:12px;"> 创建时间：'+createDate+'</span><hr style="width:90%;"></center><div style="margin:auto;width:90%;">'+data[0].get("contentText")+'</div><br><br><br><br><div style="margin:auto;width:90%;font-size:12px;">备注：'+data[0].get("remark")+'</div>'
		        	
	        	});
	        	
	        }
    	center.setActiveTab(tabId);
	}
	 return grid; 
};